
import {
    ChannelManager
} from './model.js';

export class DefalutConfig {
    constructor(options = {}) {

        const {
            inputNum = 12,
            max_gain = 20,
            min_gain = -20,
            max_delay = 8,
            colorList = ['#E10600', '#D3FB10', '#D3AE13', '#D8CC36', '#A3D845', '#7ADD3A', '#7AE584', '#46CCC5', '#4681F6', '#7627F5', '#C134F5', '#E63BF6'],
            freqList = [20, 25, 32, 40, 50, 63, 80, 100, 125, 160, 200, 250, 315, 400, 500, 630, 800, 1000, 1250, 1500, 2000, 2500, 3150, 4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000],
            effectKeys = ['POP', 'Dance', 'Rock', 'Classic', 'Vocal', 'Bass'],
            presetKeys = ['Preset1', 'Preset2', 'Preset3', 'Preset4', 'Preset5'],
            effectIndex = -1,
            presetIndex = -1,
            startBytesIndex = 0,
            effectList = [
                [-1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 2, 2, 1, 0, 0, 0, 0, -1, -1, -1, -1],
                [8, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 3, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0],
                [5, 6, 7, 5, 3, 1, 3, 4, 4, 6, 4, 2, 0, -1, -3, 0, 1, 2, 3, 4, 5, 6, 7, 5, 4, 6, 7, 6, 5, 4, 4],
                [6, 5, 5, 4, 3, 2, 1, 1, 0, 0, 0, 1, 1, 0, -1, 0, 0, 0, 0, 1, 2, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3],
                [-4, -4, -4, -4, -4, -4, -3, -2, -2, -2, -1, 2, 3, 4, 4, 6, 7, 9, 9, 7, 5, 4, 2, 1, 0, -1, -2, -2, -3, -3, -3],
                [7, 6, 5, 4, 5, 6, 7, 8, 9, 9, 8, 6, 4, 2, 0, 0, -1, -2, -3, -4, -2, -1, 0, 1, 2, 3, 2, 1, 0, -1, -2]
            ],
        } = options;

        this.inputNum = inputNum;
        this.max_gain = max_gain;
        this.min_gain = min_gain;
        this.max_delay = max_delay;
        this.colorList = colorList;
        this.freqList = freqList;
        this.effectList = effectList;
        this.effectKeys = effectKeys;
        this.presetKeys = presetKeys;
        this.effectIndex = effectIndex;
        this.presetIndex = presetIndex;
        this.startBytesIndex = startBytesIndex;///获取 设备数据 ，真正指令开始的地方。因为有的板子第一个字节就是指令，有的带有“0xAA，。。，。。。”
    }
}


//12进12出
export const SourceType = Object.freeze({
    off: 0xC0,///关闭
    bt: 0xC1,  //蓝牙
    optical: 0xC2,//光纤
    aux: 0xC3,
    usb: 0xC4,//
    rca: 0xC5,//高电平
    coaxial: 0xC6,//同轴
});

// ///6进8出 | 4进 6出
// export const SourceType = Object.freeze({
//     bt: 0xC1,
//     optical: 0xC4,
//     // aux: 0xC3,
//     // usb: 0xC4,
//     rca: 0xC3,
//     // cu: 0xC6,
// });

export const SumType = Object.freeze({
    ch2: [0xAA, 0x83, 0xF2],
    ch4: [0xAA, 0x83, 0xF4],
    ch6: [0xAA, 0x83, 0xF6],
    sum: [0xAA, 0x83, 0xFA],
    custom: [0xAA, 0x83, 0xF0],
});

export const DelayType = Object.freeze({
    ms: 'ms',
    cm: 'cm',
    inch: 'inch',
});

const source_list = [SourceType.rca, SourceType.bt, SourceType.optical, SourceType.aux, SourceType.usb, SourceType.coaxial];
const current_source_list = [SourceType.rca];
const sum_list = [SumType.ch2, SumType.ch4, SumType.ch6, SumType
    .sum, SumType.custom
];
export const chManager = new ChannelManager([], source_list, current_source_list, sum_list, SumType.custom, 0, -60, 0, false, DelayType.ms, 0, false);
chManager.config = new DefalutConfig();

// const effectList = [
//     [-1, -1, 0, 1, 5, 4, 2, 0, d-1, -1],
//     [8, 6, 3, 0, 3, 4, 7, 4, 0, 0],
//     [5, 3, 4, 4, -3, 2, 5, 4, 6, 4],
//     [6, 3, 1, 0, -1, 0, 2, 3, 3, 3],
//     [-4, -4, -2, -1, 4, 9, 5, -1, -2, -3],
//     [7, 5, 8, 8, -1, -4, 1, 2, 3, -2]
// ];


